package com.obrempon.credit.market.ui.adapter

import android.view.View
import androidx.recyclerview.widget.RecyclerView
import com.obrempon.credit.market.R
import com.obrempon.credit.market.utils.ObremponImageUtil
import com.obrempon.module.adapter.ObremponRecyclerViewAdapter
import com.obrempon.module.adapter.ObremponViewHolderHelper
import org.json.JSONObject

/**
 * ObremponCredit
 * @Author wwdeng
 * @CreateTime: 2024/11/25 11:51
 * @Annotation：贷款详情 - 账户列表
 */
class ObremponOrderDetailsWalletApt(recyclerView: RecyclerView?) : ObremponRecyclerViewAdapter<JSONObject>(recyclerView, R.layout.obrempon_order_details_account_item) {
    override fun setItemChildListener(helper: ObremponViewHolderHelper, viewType: Int) {
        helper.setItemChildClickListener(R.id.imageRemove) //点击Item
    }
    override fun fillData(helper: ObremponViewHolderHelper, position: Int, model: JSONObject) {
        var showName = model.optString("name","")
        if (showName.isEmpty() || showName == "null"){
            showName = "test"
        }
        helper.setText(R.id.textTitle,showName)
        helper.setText(R.id.textNumber,"+" + model.optString("account"))
        val imgLogo = helper.getImageView(R.id.imgLogo)
        ObremponImageUtil.instance.loadImageUrl(mContext,imgLogo,model.optString("logo"), R.mipmap.obrempon_holder)

        if (model.optBoolean("showDelete",false)){
            helper.setVisibility(R.id.imageRemove, View.VISIBLE)
        } else {
            helper.setVisibility(R.id.imageRemove, View.INVISIBLE)
        }
    }
}